unit razao1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Grids, DBGrids, DB, DBTables, StdCtrls, Mask, Buttons;

type
  TForm1 = class(TForm)
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    MaskEdit1: TMaskEdit;
    BitBtn3: TBitBtn;
    Label1: TLabel;
    Edit1: TEdit;
    DataSource1: TDataSource;
    Razao: TTable;
    DBGrid1: TDBGrid;
    RazaoData: TDateField;
    RazaoConta: TStringField;
    RazaoHp: TStringField;
    RazaoComplemento: TBlobField;
    RazaoValor: TFloatField;
    RazaoSaldo: TFloatField;
    procedure MaskEdit1Exit(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Dados;

{$R *.dfm}

procedure TForm1.MaskEdit1Exit(Sender: TObject);
begin
if fdados.contas.findkey([maskedit1.text]) then
   begin
   edit1.Text := fdados.contasnome.value;
   bitbtn3.setfocus;
   end;
end;

procedure TForm1.BitBtn3Click(Sender: TObject);
begin
fdados.Diario.First;
while not fdados.diario.eof do;
begin
if fdados.diariodevedora.asstring <> maskedit1.text then
   fdados.diario.next;
if fdados.diariocredora.asstring <> maskedit1.text then
   fdados.diario.next;
razao.append;
razaodata.value := fdados.diariodata.value;
razaohp.value   := fdados.diariohp.asstring;
razaocomplemento.value := fdados.diariocomplemento.value;
razaovalor.value := fdados.diariovalor.value;
fdados.diario.next;
end;
end;
bitbtn2.setfocus;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
close;
end;

end.
